<template>
 <div class="container">
<button @click="goback" style="float:left">goback</button>
    <div class="row" style="padding-top: 10px;">
      <div class="col-md-12">
        <div class="data_list">
          <div class="data_list_title">
            <img src="./image/detail.png" />
            邮件详细信息
          </div>

          <div class="data_details">
            <div class="data_row">
              <strong style="float:left"></strong>
              <strong class="CSS5-left">收件人 :{{ToText(message.to)}}</strong>
              <strong class="CSS5-left">是否需要回执:{{ToText(message.replySign)}}</strong>
              <p style="float:right">messageId :{{ToText(message.messageId)}}</p>
            </div>
            <div class="data_row">
              <strong>邮件主题 ：</strong>
              <span>{{ToText(message.subject)}}</span>
            </div>
            <div class="data_row">
              <strong>发件人 ：</strong>
              <span>{{ToText(message.senderName)}}</span>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              <strong>发件日期 ：</strong>
              <span>{{ToText(message.senderDate)}}(UTC-08:00 温哥华、洛杉玑、西雅图时间)</span>
            </div>
            <div class="data_row">
              <strong style="float:left">邮件内容：</strong>
              <span v-html="message.emlContent"></span>
            </div>

            <div class="data_row">
              <strong style="float:left" v-if="message.hasRead">已读 :{{ToText(message.hasRead)}}</strong>
             <strong style="float:left">抄送人 :{{ToText(message.cc)}};</strong>
             <strong style="float:left">密送人 :{{ToText(message.bcc)}};</strong>
              <strong style="float:left">是否含附件 :{{ToText(message.containAttachment)}}</strong>
            </div>
            <div class="data_row">
              <strong>免责申明：</strong>
              <br />
              <p>
                [
                <strong>{{ToText(message.subject)}}</strong> ] 由发件人
                [<strong>{{ToText(message.senderName)}}</strong>] 于
                [<strong>{{ToText(message.senderDate)}}(UTC-08:00 温哥华、洛杉玑、西雅图时间)</strong>] 发送给
                <strong>{{ToText(message.recipientAddress)}}</strong>。
                此邮件本人从邮件客户端或三方公司抓取解析，取自本人Elastic服务器只作交流和学习使用。
              </p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>


<script>
  
import axios from "axios";
export default {
  data() {
    return {
      message: {},
      downloadVisible:"false"
    };
  },
  watch:{
  $route(to,from){
    console.log(to.path);//当前页面path即/showuser
    this.init();
  }
},
  mounted() {
    this.init();
  },
  methods: {
    goback(){
        this.$router.go(-1);//返回上一层
    },
    init() {
      this.message = this.$route.query.message;
      console.log("this.message");
      console.log(this.message);
    },
    ToText(HTML) {
      if (HTML != null) {
        var input = HTML.toString();
        return input
          .replace(/<(style|script|iframe)[^>]*?>[\s\S]+?<\/\1\s*>/gi, "")
          .replace(/<[^>]+?>/g, "")
          .replace(/\s+/g, " ")
          .replace(/ /g, " ")
          .replace(/>/g, " ");
      }
    },
    
  }

};
</script>

<style  scoped>
.CSS5-left {
  float: left;
  border: 1px solid #f00;
}

 
 
  .el-col {
    border-radius: 4px;
  }
  .bg-purple-dark {
    background: #99a9bf;
  }
  .bg-purple {
    background: #d3dce6;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }
  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }
</style>
